from django.db import models


class Document(models.Model):
    name = models.CharField(max_length=50, verbose_name='名称')
    dt = models.IntegerField(verbose_name='发布时间')
    text = models.TextField(verbose_name='内容')
    exf1 = models.CharField(max_length=100, null=True, blank=True)
    exf2 = models.CharField(max_length=100, null=True, blank=True)
    exf3 = models.CharField(max_length=100, null=True, blank=True)


class Tag(models.Model):
    tag = models.CharField(max_length=50, verbose_name='名称')
    num = models.IntegerField(verbose_name='个数')
    exf1 = models.CharField(max_length=100, null=True, blank=True)
    exf2 = models.CharField(max_length=100, null=True, blank=True)
    exf3 = models.CharField(max_length=100, null=True, blank=True)


class Tag2Doc(models.Model):
    tagid = models.ForeignKey('Tag', on_delete=models.CASCADE)
    docid = models.ForeignKey('Document', on_delete=models.CASCADE)
